/**
 * 停止点击
 */
export default class Stop extends Laya.Script {
    constructor() {
        super();
    }
    onEnable() {
        //添加鼠标按下事件侦听。按时时缩小按钮。
        this.owner.on(Laya.Event.MOUSE_DOWN, this, this.stop);
        //添加鼠标抬起事件侦听。抬起时还原按钮。
        this.owner.on(Laya.Event.MOUSE_UP, this, this.stop);
        this.owner.on(Laya.Event.MOUSE_MOVE, this, this.stop);
    }

    stop(e) {
        if (e && e.stopPropagation) {
            e.stopPropagation();
        }
    }

    onDisable() {
        this.owner.off(Laya.Event.MOUSE_DOWN, this, this.stop);
        //添加鼠标抬起事件侦听。抬起时还原按钮。
        this.owner.off(Laya.Event.MOUSE_UP, this, this.stop);
        this.owner.off(Laya.Event.MOUSE_MOVE, this, this.stop);
    }
}